<?php
import( 'de.ceus-media.framework.krypton.core.Action' );
/**
 *	Environment Selector Actions.
 *	@package		mv2.action
 *	@extends		Framework_Krypton_Core_Action
 *	@uses			Example
 *	@author			Dritan Latifi <dritan@gmail.com>
 *	@since			14.07.2007
 *	@version		0.1
 */
/**
 *	Environment Selector Actions.
 *	@package		mv2.action
 *	@extends		Framework_Krypton_Core_Action
 *	@uses			Example
 *	@author			Dritan Latifi <dritan@gmail.com>
 *	@since			14.07.2007
 *	@version		0.1
 */
class Action_Panel_EnvironmentSelector extends Framework_Krypton_Core_Action
{
	/**
	 *	Constructor.
	 *	@access		public
	 *	@return		void
	 */
	function __construct()
	{
		$request = Framework_Krypton_Core_Registry::getStatic('request');
		parent::__construct();
		$this->addAction( 'selectEnvironment' );
		$this->performActions();
	}

	public function selectEnvironment()
	{
		$this->setSessionFromRequest( 'serverProjectId', 'selectServerProjectId' );
		$this->setSessionFromRequest( 'serverId', 'selectServerId' );
		$this->setSessionFromRequest( 'projectId', 'selectProjectId' );
		$this->setSessionFromRequest( 'runId', 'selectRunId' );
	}

	private function setSessionFromRequest( $sessionKey, $requestKey )
	{
		$request	= Framework_Krypton_Core_Registry::getStatic( 'request' );
		$session	= Framework_Krypton_Core_Registry::getStatic( 'session' );
		if( $request->has( $requestKey ) )
		{
			$session->set( $sessionKey , $request->get( $requestKey ) );
		}
	}
}
?>